#ifndef HISTORYITEMMODEL_H
#define HISTORYITEMMODEL_H
#include <QString>
#include <QDateTime>
#include <QUrl>
class QSqlQuery;
class historyitemmodel : public QObject
{
    Q_OBJECT
public:
    historyitemmodel(QObject *parent = nullptr);
    //historyitemmodel(QString downloadFileDir, QString downloadFileName, QUrl url, QDateTime curTime, qreal totalBytes);
    QString downloadFileDir;
    QString downloadFileName;
    QUrl url;
    QDateTime curTime;
    qreal totalBytes;
    //static QString DICTIONARY;
    enum DownloadState {
        DownloadCompleted,
        DownloadCancelled,
        DownlaodDeleted,
    };
    Q_ENUM(DownloadState)
    DownloadState currentState;
    QString account;



    void insertRecord();
    void updateStateToDelete();

    static bool downloadDirValid();
    static QString getDownloadDir();
    static void changeDownloadDir(QString dir);
    static void deleteAll();
    static QSqlQuery* conductQuery();
    QIcon getIconByFileEx();
public slots:
    void deleteRecord();


};

#endif // HISTORYITEMMODEL_H
